package cn.com.cetccst.messagecenter;

import android.content.Context;

import cn.com.cetccst.datacenter.message.InboxMessageRespository;

public class MessageManager {
    private static MessageManager INSTANCE;
    private Context context;

    public static MessageManager getInstance() {
        return INSTANCE;
    }

    public static void initialize(Context context) {
        INSTANCE = new MessageManager(context);
    }

    public MessageManager(Context context) {
        this.context = context;
        InboxMessageRespository.getInstance().getUnreadCount().observeForever((count) -> {
            if (count > 0) {
                MessageUtil.newMessageNotification(context, count);
            }
        });
    }
}
